module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/* eslint-disable */
// 小程序开发api接口工具包，https://github.com/gooking/wxapi
var API_BASE_URL;
var subDomain = 'tz';

var request = function request(url, needSubDomain, method, data) {
  //API_BASE_URL = wx.getStorageSync('YU');
  //var _url = API_BASE_URL + (needSubDomain ? '/' + subDomain : '') + url;
  var _url = wx.getStorageSync('YU') + url;
  return new Promise(function (resolve, reject) {
    wx.request({
      url: _url,
      method: method,
      data: data,
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function success(request) {
        if (request.data.code){
          resolve(request.data);
        }
        else{
          console.log('请求数据返回错误XXXXXXXXXXXX---------------------' + url + '--------------------------' + request.data);
          resolve(request.data);
        }
      },
      fail: function fail(error) {
        reject(error);
      },
      complete: function complete(aaa) {
        // 加载完成
      }
    });
  });
};

/**
 * 小程序的promise没有finally方法，自己扩展下
 */
// Promise.prototype.finally = function (callback) {
//   var Promise = this.constructor;
//   return this.then(function (value) {
//     Promise.resolve(callback()).then(function () {
//       return value;
//     });
//   }, function (reason) {
//     Promise.resolve(callback()).then(function () {
//       throw reason;
//     });
//   });
// };

module.exports = {
  init2: function init2(a, b) {
    API_BASE_URL = a;
    subDomain = b;
  },
  init: function init(b) {
    subDomain = b;
  },
  request: request,
  apiLogin: function apiLogin(dataObj){
    return request('/client/apitowx/wsLogin.php?g=wsResLogin', false, 'post', dataObj);
  },
  bindMobile: function bindMobile(dataObj) {
    return request('/client/apitowx/wsLogin.php?g=bindMobile', false, 'post', dataObj);
  },
  //获取用户信息
  userInfo: function userInfo(dataObj) {
    return request('/client/apitowx/wsLogin.php?g=getUinfo', false, 'post', dataObj);
  },
  getSportRunNum: function getSportRunNum(dataObj) {
    return request('/client/apitowx/wsLogin.php?g=getSportRunNum', false, 'post', dataObj);
  },
  //我的请求提现操作
  mytoTiXian: function mytoTiXian(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=autoPayWXBag', false, 'post', dataObj);
  },
  //请求首页banner
  indexBanner: function indexBanner(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=indexBanner', false, 'post', dataObj);
  },
  //请求首页功能块的行广告
  indexHAD: function indexHAD(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=indexHAD', false, 'post', dataObj);
  },
  getMsgList: function getMsgList(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=getMsgList', false, 'post', dataObj);
  },
  getYeZhuList: function getYeZhuList(dataObj) {
    return request('/client/apitowx/wsWuye.php?g=getYeZhuList', false, 'post', dataObj);
  },
  //查找物业的房号信息
  initFangInfo: function initFangInfo(dataObj) {
    return request('/client/apitowx/wsWuye.php?g=initFangInfo', false, 'post', dataObj);
  },
  //查找该房主的物业缴费清单
  findFeiOrderList: function findFeiOrderList(dataObj) {
    return request('/client/apitowx/wsWuye.php?g=findFeiOrderList', false, 'post', dataObj);
  },
  //查看信息详情
  msgDes: function msgDes(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=msgDes', false, 'post', dataObj);
  },
  //查找百商惠商家列表--后台还没有写代码
  tripShopList: function tripShopList(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=getTripShopList', false, 'post', dataObj);
  },
  //查找百商惠的活动详情--后台还没有写代码
  shopDesAndActivies: function shopDesAndActivies(dataObj) {
    return request('/client/apitowx/wsIndex.php?g=getShopDesAndActivies', false, 'post', dataObj);
  },
  //上传水表照片
  uploadSbImg: function uploadSbImg(dataObj) {
    return request('/client/apitowx/wsWuye.php?g=uploadSbImg', false, 'post', dataObj);
  },
  //上传水表照片
  toBuyActInit: function uploadSbImg(dataObj) {
    return request('/client/apitowx/wsWuye.php?g=payOrderInit', false, 'post', dataObj);
  },
  //查找直播间列表
  wxaMpLiveRoomHisVedios: function wxaMpLiveRoomHisVedios(roomId) {
    return request('/wx/live/his', true, 'get', {
      roomId: roomId
    });
  }
};

/***/ })
/******/ ]);